using System.Collections.Generic;

namespace HtmlUtilities.UITest
{
    public static class ScriptObjectCollectionCommands
    {
        public static IEnumerable<Command<string>> GetCommands()
        {
            return new List<Command<string>>
                       {
                           new Command<string>("Count", () => TestDiv.Children.Count.ToString()),
                           new Command<string>("Indexer", Indexer)
                       };
        }

        private static IHtmlElement TestDiv { get { return Html.Page.Document.GetElementById("testing"); } }

        private static string Indexer()
        {
            var tags = new List<string>();
            for (int i = 0; i < TestDiv.Children.Count; i++)
                tags.Add((TestDiv.Children[i] as IHtmlElement).TagName);

            return string.Join(", ", tags.ToArray());
        }
    }
}